VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form Form2 
   BackColor       =   &H80000003&
   Caption         =   "Form2"
   ClientHeight    =   9120
   ClientLeft      =   225
   ClientTop       =   1845
   ClientWidth     =   16350
   ForeColor       =   &H8000000D&
   LinkTopic       =   "Form2"
   ScaleHeight     =   9120
   ScaleWidth      =   16350
   Begin VB.ComboBox Combo5 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   2040
      TabIndex        =   28
      Top             =   5520
      Width           =   1815
   End
   Begin VB.ComboBox Combo4 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   2040
      TabIndex        =   27
      Top             =   4920
      Width           =   1815
   End
   Begin VB.ComboBox Combo3 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   2040
      TabIndex        =   23
      Top             =   4200
      Width           =   1815
   End
   Begin VB.ComboBox Combo2 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   2040
      TabIndex        =   22
      Top             =   3480
      Width           =   2055
   End
   Begin VB.CommandButton Command6 
      BackColor       =   &H80000003&
      Caption         =   "Search"
      DownPicture     =   "Form2.frx":0000
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   11760
      MaskColor       =   &H00000080&
      Style           =   1  'Graphical
      TabIndex        =   20
      Top             =   1440
      Width           =   975
   End
   Begin MSFlexGridLib.MSFlexGrid Grid1 
      Height          =   5175
      Left            =   6000
      TabIndex        =   19
      Top             =   2760
      Width           =   9975
      _ExtentX        =   17595
      _ExtentY        =   9128
      _Version        =   393216
      Rows            =   11
      Cols            =   11
      BackColor       =   16777215
      ForeColor       =   0
      BackColorFixed  =   -2147483645
      ForeColorFixed  =   0
      ForeColorSel    =   12640511
      BackColorBkg    =   16777215
   End
   Begin VB.ComboBox Combo1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   2040
      TabIndex        =   9
      Top             =   2880
      Width           =   3015
   End
   Begin VB.TextBox Txt2 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   480
      Left            =   2040
      TabIndex        =   8
      Top             =   2040
      Width           =   3015
   End
   Begin VB.TextBox Txt3 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   480
      Left            =   2040
      TabIndex        =   7
      Top             =   6240
      Width           =   1815
   End
   Begin VB.TextBox Txt4 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Left            =   2040
      TabIndex        =   6
      Top             =   6960
      Width           =   1815
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000003&
      Caption         =   "Clear"
      DisabledPicture =   "Form2.frx":08CA
      DownPicture     =   "Form2.frx":1194
      DragIcon        =   "Form2.frx":1A5E
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6240
      MaskColor       =   &H00000080&
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   1440
      Width           =   1095
   End
   Begin VB.TextBox Txt1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Left            =   2040
      TabIndex        =   4
      Top             =   1320
      Width           =   1935
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H80000003&
      Caption         =   "Add"
      DownPicture     =   "Form2.frx":2328
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   7680
      MaskColor       =   &H00000080&
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   1440
      Width           =   1095
   End
   Begin VB.CommandButton Command3 
      BackColor       =   &H80000003&
      Caption         =   "Delete"
      DownPicture     =   "Form2.frx":2BF2
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   10440
      MaskColor       =   &H00000080&
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   1440
      Width           =   975
   End
   Begin VB.CommandButton Command4 
      BackColor       =   &H80000003&
      Caption         =   "Update"
      DownPicture     =   "Form2.frx":34BC
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   9120
      MaskColor       =   &H00000080&
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   1440
      Width           =   975
   End
   Begin VB.CommandButton Command5 
      BackColor       =   &H80000003&
      Caption         =   "Exit"
      DownPicture     =   "Form2.frx":3D86
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   14520
      MaskColor       =   &H00000080&
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   1440
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H80000003&
      Caption         =   "Please Select Object"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   1335
      Left            =   5880
      TabIndex        =   24
      Top             =   960
      Width           =   10215
      Begin VB.CommandButton Command7 
         BackColor       =   &H80000003&
         Caption         =   "Buy"
         DownPicture     =   "Form2.frx":4650
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   222
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   7200
         MaskColor       =   &H00000080&
         Style           =   1  'Graphical
         TabIndex        =   31
         Top             =   480
         Width           =   1215
      End
   End
   Begin VB.PictureBox Adodc1 
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   495
      Left            =   7200
      ScaleHeight     =   435
      ScaleWidth      =   1995
      TabIndex        =   30
      Top             =   6840
      Visible         =   0   'False
      Width           =   2055
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H80000003&
      Caption         =   "Game Store Database"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   5535
      Left            =   5880
      TabIndex        =   25
      Top             =   2400
      Width           =   10215
   End
   Begin VB.Frame Frame3 
      BackColor       =   &H80000003&
      Caption         =   "Please Input Data"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   6975
      Left            =   1920
      TabIndex        =   29
      Top             =   960
      Width           =   3375
   End
   Begin VB.Label Label2 
      Alignment       =   1  'Right Justify
      BackColor       =   &H80000003&
      Caption         =   "Bath"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   615
      Left            =   5040
      TabIndex        =   26
      Top             =   7080
      Width           =   735
   End
   Begin VB.Label Label14 
      Alignment       =   1  'Right Justify
      BackColor       =   &H80000003&
      Caption         =   "Price"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   615
      Left            =   120
      TabIndex        =   21
      Top             =   7080
      Width           =   735
   End
   Begin VB.Label Label11 
      BackColor       =   &H80000003&
      Caption         =   "ID-Code"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   495
      Left            =   360
      TabIndex        =   18
      Top             =   1320
      Width           =   1455
   End
   Begin VB.Label Label1 
      BackColor       =   &H80000003&
      Caption         =   "GAME STORE"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   615
      Left            =   5400
      TabIndex        =   17
      Top             =   240
      Width           =   3615
   End
   Begin VB.Label Label3 
      BackColor       =   &H80000003&
      Caption         =   "Game Name"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   615
      Left            =   360
      TabIndex        =   16
      Top             =   2040
      Width           =   1575
   End
   Begin VB.Label Label4 
      Alignment       =   1  'Right Justify
      BackColor       =   &H80000003&
      Caption         =   "Disc Zone"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   495
      Left            =   360
      TabIndex        =   15
      Top             =   2880
      Width           =   1095
   End
   Begin VB.Label Label5 
      Alignment       =   1  'Right Justify
      BackColor       =   &H80000003&
      Caption         =   "InStock"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   495
      Left            =   360
      TabIndex        =   14
      Top             =   4200
      Width           =   855
   End
   Begin VB.Label Label6 
      Alignment       =   1  'Right Justify
      BackColor       =   &H80000003&
      Caption         =   "Game Console"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   615
      Left            =   120
      TabIndex        =   13
      Top             =   4920
      Width           =   1815
   End
   Begin VB.Label Label7 
      Alignment       =   1  'Right Justify
      BackColor       =   &H80000003&
      Caption         =   "Rate"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   615
      Left            =   240
      TabIndex        =   12
      Top             =   5640
      Width           =   615
   End
   Begin VB.Label Label8 
      Alignment       =   1  'Right Justify
      BackColor       =   &H80000003&
      Caption         =   "Language"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   495
      Left            =   360
      TabIndex        =   11
      Top             =   3480
      Width           =   1095
   End
   Begin VB.Label Label9 
      Alignment       =   1  'Right Justify
      BackColor       =   &H80000003&
      Caption         =   "Made by"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   495
      Left            =   240
      TabIndex        =   10
      Top             =   6360
      Width           =   975
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim Sql As String

Private Sub Command6_Click()
Form2.Hide
Form3.Show
End Sub

Private Sub Command7_Click()
Form2.Hide
Form4.Show
End Sub

Private Sub Form_Load()
If conn.State = 1 Then conn.Close
conn.Open "provider =microsoft.jet.oledb.4.0;data source=" & App.Path & "\m5.mdb"
MsgBox "ติดต่อกับฐานข้อมูลได้แล้วครับ"
Gridshow
End Sub
Private Sub Command1_Click()
Txt1 = ""
Txt2 = ""
Combo1 = ""
Combo2 = ""
Combo3 = ""
Combo4 = ""
Combo5 = ""
Txt3 = ""
Txt4 = ""
End Sub
Private Sub Command2_Click()
If (Txt1.Text = "") Then
    MsgBox "Please Key ID-Code", vbOKOnly, "Warning"
    Txt1.SetFocus
    Exit Sub
End If
If (Txt2.Text = "") Then
    MsgBox "Please Key Game Name", vbOKOnly, "Warning"
    Txt2.SetFocus
    Exit Sub
End If
If (Combo1.Text = "") Then
    MsgBox "Please Select Disc Zone", vbOKOnly, "Warning"
    Combo1.SetFocus
    Exit Sub
End If
If (Combo2.Text = "") Then
    MsgBox "Please Select Language", vbOKOnly, "Warning"
    Combo2.SetFocus
    Exit Sub
End If
If (Combo3.Text = "") Then
    MsgBox "Please Select  in Stock", vbOKOnly, "Warning"
    Combo3.SetFocus
    Exit Sub
End If
If (Combo4.Text = "") Then
    MsgBox "Please Select Game Console", vbOKOnly, "Warning"
    Combo4.SetFocus
    Exit Sub
End If
If (Combo5.Text = "") Then
    MsgBox "Please Select  Rate", vbOKOnly, "Warning"
    Combo5.SetFocus
    Exit Sub
End If
If (Txt3.Text = "") Then
    MsgBox "Please Key Made by", vbOKOnly, "Warning"
    Txt3.SetFocus
    Exit Sub
End If
If (Txt4.Text = "") Then
    MsgBox "Please Key Price", vbOKOnly, "Warning"
    Txt4.SetFocus
    Exit Sub
End If
If conn.State = 1 Then conn.Close
conn.Open "provider =microsoft.jet.oledb.4.0;data source=" & App.Path & "\m5.mdb"
Sql = "select * from student5 where stdid = '" & Txt1 & "'"
rs.Open Sql, conn, 3, 3
If rs.RecordCount > 0 Then
MsgBox "มีข้อมูลตามรหัสนี้แล้ว", vbOK + vbExclamation, "แจ้งเตือน"
Else
If conn.State = 1 Then conn.Close
conn.Open "provider =microsoft.jet.oledb.4.0;data source=" & App.Path & "\m5.mdb"
Sql = "insert into student5  values('" & Txt1 & "','" & Txt2 & "','" & Combo1 & "', '" & Combo2 & "','" & Combo3 & "','" & Combo4 & "','" & Combo5 & "','" & Txt3 & "','" & Txt4 & "')"
rs.Open Sql, conn, 3, 3
MsgBox "บันทึกข้อมูลแล้ว", vbOK + vbInformation, "ยืนยัน"
End If
Gridshow
End Sub
Private Sub Command3_Click()
If conn.State = 1 Then conn.Close
conn.Open "provider =microsoft.jet.oledb.4.0;data source=" & App.Path & "\m5.mdb"
Sql = "delete * from student5 where stdid = '" & Txt1 & "'"
rs.Open Sql, conn, 3, 3
MsgBox "ลบข้อมูลนี้แล้ว", vbOK + vbInformation, "ยืนยัน"
Gridshow
End Sub
Private Sub Command4_Click()
If conn.State = 1 Then conn.Close
conn.Open "provider =microsoft.jet.oledb.4.0;data source=" & App.Path & "\m5.mdb"
Sql = "update student5  set stdf='" & Txt2 & "', stdname='" & Combo1 & "', stdsur='" & Combo2 & "', stdaddress='" & Combo3 & "', stdamp='" & Combo4 & "', stdpro='" & Combo5 & "', stdtel='" & Txt3 & "', stdemail='" & Txt4 & "'where stdid='" & Txt1 & "'"
rs.Open Sql, conn, 3, 3
MsgBox "ปรับปรุงฐานข้อมูลนี้แล้ว", vbOK + vbInformation, "ยืนยัน"
Gridshow
End Sub
Private Sub Command5_Click()
If MsgBox("คุณต้องการออกจากโปรแกรมใช้หรือไม่", vbOKCancel + vbInformation, "ยืนยัน") = vbOK Then
   Unload Me
End If
End Sub
Sub Gridshow()
With Me.Combo1
    .AddItem "Z1"
    .AddItem "Z2"
    .AddItem "Z3"
    .AddItem "No Zone"
    .ListIndex = 0
End With
With Me.Combo2
    .AddItem "English"
    .AddItem "Japanese"
    .ListIndex = 0
End With
With Me.Combo3
    .AddItem "1"
    .AddItem "2"
    .AddItem "3"
    .AddItem "4"
    .AddItem "5"
    .AddItem "6"
    .AddItem "7"
    .AddItem "8"
    .AddItem "9"
    .AddItem "10"
    .ListIndex = 0
End With
With Me.Combo4
    .AddItem "Ps3"
    .AddItem "Xbox360"
    .ListIndex = 0
End With
With Me.Combo5
    .AddItem "1"
    .AddItem "1.5"
    .AddItem "2"
    .AddItem "2.5"
    .AddItem "3"
    .AddItem "3.5"
    .AddItem "4"
    .AddItem "4.5"
    .AddItem "5"
    .AddItem "5.5"
    .AddItem "6"
    .AddItem "6.5"
    .AddItem "7"
    .AddItem "7.5"
    .AddItem "8"
    .AddItem "8.5"
    .AddItem "9"
    .AddItem "9.5"
    .AddItem "10"
    .ListIndex = 0
End With
Dim i As Integer
With Grid1
     .Cols = 10
     .Rows = 1
     .ColWidth(0) = 300
     .ColWidth(1) = 770
     .ColWidth(2) = 2800
     .ColWidth(3) = 1000
     .ColWidth(4) = 1000
     .ColWidth(5) = 800
     .ColWidth(6) = 1200
     .ColWidth(7) = 550
     .ColWidth(8) = 1300
     .ColWidth(9) = 500
     .ColAlignment(0) = 9
     .ColAlignment(1) = 9
      .TextMatrix(0, 0) = "No"
     .TextMatrix(0, 1) = "ID-Code"
     .TextMatrix(0, 2) = "Game Name"
     .TextMatrix(0, 3) = "Disc Zone"
     .TextMatrix(0, 4) = "Language"
     .TextMatrix(0, 5) = "In Stock"
     .TextMatrix(0, 6) = "Game Console"
     .TextMatrix(0, 7) = "Rate"
     .TextMatrix(0, 8) = "Made by"
     .TextMatrix(0, 9) = "Price"
If conn.State = 1 Then conn.Close
conn.Open "provider =microsoft.jet.oledb.4.0;data source=" & App.Path & "\m5.mdb"
Sql = "select * from student5 order by stdid"
rs.Open Sql, conn, 3, 3
i = 1
If rs.RecordCount <> 0 Then
Do Until rs.EOF
.Rows = .Rows + 1
.TextMatrix(i, 0) = i
.TextMatrix(i, 1) = rs("stdid") & ""
.TextMatrix(i, 2) = rs("stdf") & ""
.TextMatrix(i, 3) = rs("stdname") & ""
.TextMatrix(i, 4) = rs("stdsur") & ""
.TextMatrix(i, 5) = rs("stdaddress") & ""
.TextMatrix(i, 6) = rs("stdamp") & ""
.TextMatrix(i, 7) = rs("stdpro") & ""
.TextMatrix(i, 8) = rs("stdtel") & ""
.TextMatrix(i, 9) = rs("stdemail") & ""
i = i + 1
rs.MoveNext
Loop
Else
MsgBox "ไม่มีมีข้อมูล", vbOK + vbInformation, "แจ้งเตือน"
.Rows = 1
End If
End With
rs.Close
End Sub
Sub reload()
With Grid1
Txt1 = .TextMatrix(.Row, 1)
If conn.State = 1 Then conn.Close
conn.Open "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\m5.mdb"
Sql = "select * from student5  where  stdid='" & Txt1 & "'"
rs.Open Sql, conn, 3, 3
If rs.RecordCount > 0 Then
Txt2 = rs("stdf") & ""
Combo1 = rs("stdname") & ""
Combo2 = rs("stdsur") & ""
Combo3 = rs("stdaddress") & ""
Combo4 = rs("stdamp") & ""
Combo5 = rs("stdpro") & ""
Txt3 = rs("stdtel") & ""
Txt4 = rs("stdemail") & ""
End If
End With
End Sub
Private Sub Grid1_Click()
   reload
End Sub

Private Sub Txt1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Then
    ElseIf (KeyAscii = 13) Then
        Txt2.SetFocus
Else
    MsgBox "ระบุได้เฉพาะตัวเลข (0-9)", vbOKOnly, "แจ้งเตือน"
    KeyAscii = 0
    Txt1.SetFocus
    Exit Sub
End If
End Sub
Private Sub Txt2_KeyPress(KeyAscii As Integer)
If (KeyAscii = 13) Then
    Combo1.SetFocus
End If
End Sub

Private Sub Combo1_KeyPress(KeyAscii As Integer)
If (KeyAscii = 13) Then
    Combo2.SetFocus
End If
End Sub
Private Sub Combo2_KeyPress(KeyAscii As Integer)
If (KeyAscii = 13) Then
    Combo3.SetFocus
End If
End Sub
Private Sub Combo3_KeyPress(KeyAscii As Integer)
If (KeyAscii = 13) Then
    Combo4.SetFocus
End If
End Sub
Private Sub Combo4_KeyPress(KeyAscii As Integer)
If (KeyAscii = 13) Then
    Combo5.SetFocus
End If
End Sub
Private Sub Combo5_KeyPress(KeyAscii As Integer)
If (KeyAscii = 13) Then
    Txt3.SetFocus
End If
End Sub
Private Sub Txt3_KeyPress(KeyAscii As Integer)
If (KeyAscii = 13) Then
    Txt4.SetFocus
End If
End Sub
Private Sub Txt4_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Then
    ElseIf (KeyAscii = 13) Then
        Command2.SetFocus
Else
    MsgBox "ระบุได้เฉพาะตัวเลข (0-9)", vbOKOnly, "แจ้งเตือน"
    KeyAscii = 0
    Txt4.SetFocus
    Exit Sub
End If
End Sub

